function ProtectionStatusEvaluation(){
	var descData = undefined;
	var mapData = undefined;
	var tableData = undefined;
	var points = undefined;
	
	this.setData = function(d){
		mapData = d.mapData;
		descData = d.descData;
		tableData = d.tableData;
		return this;
	};
	function initData(){
		$.ajaxSettings.async = false;
		$.getJSON("/rest/protectRiskAssment/getGridSecondaryEvaluation",function(result){
			mapData = result.mapData;
			descData = result.descData;
			tableData = result.tableData;
		});
		$.ajaxSettings.async = true;
	}
	this.drawPoints = function(){
		if(!mapData){
			initData();
		}
		if(!points){
			genPoints();
		}
		if(points.length>0){
			selectFeature.activate();
			selectedLayer.addFeatures(points);
			selectedLayer.setVisibility(true);
		}
	};
	this.removePoints = function(){
		if(points){
			selectedLayer.removeFeatures(points);
		}
		return this;
	};
	this.getTableDiv = function(){
		if(!tableData){
			initData();
		}
		if(isZero(descData)){
			return null;
		}
		var td = [];
		var tb = $('<table style="width:300px;" class="table table-bordered table-hover" />');
		var data = [];
		var index = 1;
		for(var i in tableData){
			data.push(['<i style="background:'+tableData[i].color+';padding:0 5px;color:white;font-weight: bolder;margin:10px;">'+index+'</i>'+tableData[i].content,tableData[i].source,tableData[i].msgType]);
			index ++;
		}
		var opt = MyTable.getDefaultOptions();
		opt.scrollY = 300;
		opt.scrollCollapse = true;
		var columns = ['告警信息'];
		table = new MyTable(tb,columns,opt).setDataSet(data).show();
		table.onRowClick(function(data){
			var url = '';
			switch (data[2]) {
			case "hlyc":
				url = "/ui/map/dialog/riskAlarmDialog/protectDeviceException.xhtml?oId="
								+ data[1];
				break;
			case "tdyc_single":
			case "tdyc_double":
				url = "/ui/map/dialog/riskAlarmDialog/protectChannelException.xhtml?oId="
								+ data[1];
				break;
			}
			if(url){
				MyModal.showModal(url);
			}
		});
		return tb;
	};
	this.getDescDiv = function(){
		if(!descData){
			initData();
		}
		if(isZero(descData)){
			return PanelTablesUtil.getSmileInfo("无保护异常情况");
		}
		/*var ul = $("<ul style='margin-left:20px;'></ul>");
		for(var i in descData){
			getLi(descData[i]).appendTo(ul);
		}
		function getLi(item){
			return $("<li class='riskFactor' style='cursor:pointer;'></li>").html("<span style='margin-right:10px;'>"
					+item.name+":</span><span style='font-size:24px;color:"+item.color+"'>"+item.value+"</span>");
		}*/
		
		var pieDiv = $('<div style="height:150px;width:300px"></div>');
		var pie = new Pie(pieDiv);
		var pieData = [];
		var legend = [];
		var colors = [];
		for(var i in descData){
			var d = descData[i];
			colors.push(d.color);
			pieData.push({
				name:d.name,
				value:d.value,
			});
			legend.push(d.name);
		}
		pie.setPie(pieData);
		pie.addColor(colors);
		pie.setPieOuterRadius('60%');
		pie.setLegendPosition('right', 'bottom');
		var opt = pie.getOption();
		opt.toolbox.show = false;
		opt.series[0].startAngle = -90;
		opt.series[0].label.normal.formatter = '{b} {c}';
		opt.legend.data = legend;
		pie.show();
		pie.getChart().on('click',function(params){
			for(var i in descData){
				var r = descData[i];
				if(r.name == params.name){
					MyModal.showModal('/ui/map/dialog/protectwarning/protectWarningList.xhtml?msgIds='+r.params,
							null,null,params.name+'告警');
					break;
				}
			}
		});
		return pieDiv;
	};
	function isZero(data){
		for(var i in data){
			if(data[i].value != '0'){
				return false;
			}
		}
		return true;
	}
	function genPoints(){
		points = [];
		for (var i in mapData) {
			var ss = mapData[i];
			var point = new SuperMap.Geometry.Point(ss.lon,
					ss.lat);
			var pointVector = new SuperMap.Feature.Vector(point);
			pointVector.style = {
				strokeColor : "green",
				externalGraphic:'/resources/img/redYellowCircle.gif',
				pointRadius : 6
			};
			pointVector.data.type = 'secondary';
			pointVector.data.value = {station:{
				id:ss.stationId,
				name:ss.stationName
			}};
			points.push(pointVector);
		}
	}
}